package models.seller.ebay;

import javax.persistence.*;

import java.sql.*;
import java.sql.Blob;

import javax.sql.*;

import models.user.Customer;
import controllers.Application;

import java.math.*;
import java.util.*;
import java.util.Date;

import play.db.jpa.Model;
import play.cache.Cache;
import play.db.jpa.*;
import play.mvc.Scope;

/**
 * ebay 帐号信息; 本公司仅记录 帐号昵称,授权信息
 * 
 * @author yechao
 * @date 2013年11月2日
 */
@Entity
@Table(name = "ebay_seller_account")
public class EbaySellerAccount extends Model {
	/**
	 * 客户Id customer表的id
	 */
	@Column(name = "customer_id")
	public Long customerId;

	/**
	 * 客户帐号
	 */
	@ManyToOne(cascade = { CascadeType.MERGE, CascadeType.REFRESH }, optional = false, fetch = FetchType.LAZY)
	@JoinColumn(name = "customer_id", insertable = false, updatable = false)
	public Customer customer;

	/**
	 * 开发者帐号Id
	 */
	@Column(name = "ebay_developer_account_id")
	public Long ebayDeveloperAccountId;

	/**
	 * ebay开发帐号
	 */
	@ManyToOne(cascade = { CascadeType.MERGE, CascadeType.REFRESH }, optional = false, fetch = FetchType.LAZY)
	@JoinColumn(name = "ebay_developer_account_id", insertable = false, updatable = false)
	public EbayDeveloperAccount ebayDeveloperAccount;

	/**
	 * 帐号状态
	 */
	@Column(name = "status", length = 2)
	public Integer status;

	/**
	 * 创建时间,亦可理解为授权时间
	 */
	@Column(name = "created_time")
	public Long createdTime;

	/**
	 * 帐号昵称,由客户自己设置
	 */
	@Column(name = "nick_name", length = 20)
	public String nickName;
	/**
	 * ebay token 信息
	 */
	@Column(name = "ebay_token", length = 1000)
	public String ebayToken;

	/**
	 * ebay 授权信息到期时间
	 */
	@Column(name = "ebay_token_expired_time")
	public Date ebayTokenExpiredTime;
}
